﻿using S.Authorization.Common.Dto;
using S.Authorization.Domain.Model.Authority;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace S.Authorization.Infrastructure.Interface.RoleMenu
{
    /// <summary>
    /// 设置角色的权限
    /// </summary>
    public interface IRoleMenuRepository:IBaseRepository<RoleMenuList>
    {
        /// <summary>
        /// 设置用户的角色权限
        /// </summary>
        /// <param name="models">添加的数据</param>
        /// <returns>返回受影响的行数</returns>
        Task<int> AddRangeRoleMenuAsync(List<FeatureMenuRole> models);

        /// <summary>
        /// 显示当前用户下的菜单
        /// </summary>
        /// <param name="userId">当前用户登录ID</param>
        /// <returns>返回该用户下的权限菜单</returns>
        List<MenuItemDto> GetMenuList(int pId, int userId);
        /// <summary>
        /// 显示当前用户下的菜单
        /// </summary>
        /// <param name="userId">当前用户登录ID</param>
        /// <returns>返回该用户下的权限菜单</returns>
        List<int> GetMenuIdByPId(int pId, int roleId);

        /// <summary>
        /// 获取每个菜单下的所有功能
        /// </summary>
        /// <param name="menuId">菜单Id</param>
        /// <returns>返回查询后的数据</returns>
        Task<List<MenuItemDto>> GetMenuAndOperation(int? menuId);

        /// <summary>
        /// 显示菜单功能角色
        /// </summary>
        /// <param name="menuId">菜单ID</param>
        /// <returns></returns>
        Task<List<FeatureMenuRoleDto>> GetFeatureMenuRole(int menuId);

        /// <summary>
        /// 删除菜单功能角色表
        /// </summary>
        /// <param name="menuId">菜单ID</param>
        /// <param name="roleId">角色ID</param>
        /// <returns></returns>
        Task<bool> DeleteRangeFeatureMenuRole(string menuId, string roleId);

        /// <summary>
        /// 菜单表--根据MId获取PId
        /// </summary>
        /// <param name="mIds">主键Id</param>
        /// <returns>返回该数据的父级</returns>
        Task<List<int>> GetMenuPIdByMId(string mIds);
    }
}
